package memorphic.slide.debugger
{
	import flash.display.InteractiveObject;
	
	import memorphic.logging.LogPanelTarget;
	import memorphic.slide.IStateView;
	import memorphic.slide.SlidePresModelBase;
	import memorphic.slide.debugger.controllers.DebuggerController;
	
	import mx.logging.Log;

	public class DebuggerAppMain extends SlidePresModelBase
	{
		private var rootContext:IDebuggerAppContext;
		
		
		public function DebuggerAppMain(view:IStateView)
		{
			super(view);
			rootContext = IDebuggerAppContext(view);
			initLogging();
			initApp();
		}
		
		private function initLogging():void
		{
			Log.addTarget(LogPanelTarget.getInstance());
		}
		
		
		private function initApp():void
		{
			rootContext.stateManager = new DebuggerStateManager();
			rootContext.overlayOptions = new OverlayOptions();
			rootContext.debuggerController = new DebuggerController(rootContext.stateManager, rootContext);
			SlideDebugger.initContextMenu(view as InteractiveObject);
		}
	}
}